package com.tantinale.miaoshaproject.controller;

import com.tantinale.miaoshaproject.dao.UserDOMapper;
import com.tantinale.miaoshaproject.dataobject.UserDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController //@ResponseBody: 返回的结果作为http页面内容输出
public class HelloController {

    @Autowired
    private UserDOMapper userDOMapper;

    @RequestMapping("/hello")
    public String hello(){
        UserDO userDO = userDOMapper.selectByPrimaryKey(1);
        if (userDO==null){
            return "用户不存在";
        }else{
            return userDO.getName();
        }
    }

}
